/**
 * 
 */
package com.nd.android.musicboxlibrary.ui.adapter;

import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;

/**
 * 播放器界面适配器 Created 2014-7-12 下午9:32:46
 * 
 * @version
 * @author zxq
 * 
 * @see
 */
public class PlayerPagerAdapter extends PagerAdapter {
    private List<View> mLstViews;

    /**
     * Creates a new instance of PlayerPagerAdapter. Created 2014-7-12 下午9:34:01
     * 
     * @param lstViews List<View>
     */
    public PlayerPagerAdapter(List<View> lstViews) {
        super();
        this.mLstViews = lstViews;
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView(mLstViews.get(position));
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        // 添加页卡
        container.addView(mLstViews.get(position), 0);
        return mLstViews.get(position);
    }

    @Override
    public int getCount() {
        return mLstViews.size();
    }

    @Override
    public boolean isViewFromObject(View view, Object obj) {
        return view == obj;
    }
}
